//引入express
const express = require("express");
//引入路由模块
const router = require("./router");
const cors = require("cors");

//创建服务器
const app = express();
app.use(cors());

//配置解析表单数据的中间件
app.use(express.urlencoded({ extended: false }));
app.use(express.json())

//注册路由模块
app.use("/api", router);

//监听端口
app.listen(8000, () => {
  console.log("服务器启动成功");
});
